package com.moshme.project.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.moshme.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.poi.hpsf.Decimal;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * @author 望夜
 * @description
 * @date 2023/9/11---10:28
 */
@Data
@Accessors(chain = true)
@TableName("stage_construction")
@ApiModel(description = "施工信息")
public class StageConstruct {
    @ApiModelProperty("施工Id")
    @TableId(type = IdType.AUTO)
    private Long id;

    @ApiModelProperty("项目id")
    @Excel(name = "项目id")
    private Long projectId;

    @ApiModelProperty("人员id")
    @Excel(name = "人员id")
    private Long userId;

    @ApiModelProperty("该日期项目所有已填写人员")
    @TableField(exist = false)
    private String userName;

    @ApiModelProperty("施工日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "施工日期", width = 30, dateFormat = "yyyy-MM-dd")
    @NotNull(message = "日期不能为空")
    private LocalDate constructDate;

    @ApiModelProperty("区间选择日期数组(查询用)")
    @TableField(exist = false)
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate[] dateArray;

    @ApiModelProperty("施工内容")
    @Excel(name = "施工内容")
    private String constructContent;

    @ApiModelProperty("遇到的问题及建议")
    @Excel(name = "遇到的问题及建议")
    private String advice;

    @ApiModelProperty("今日耗时")
    @Excel(name = "今日耗时")
    @DecimalMin(value = "0", message = "今日耗时必须大于等于0")
    @DecimalMax(value = "24", message = "今日耗时必须小于等于24")
    private Double timeConsume;

    @TableField(exist = false)
    private String timeConsumes;

//    @ApiModelProperty("当天施工开始时间")
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
//    @Excel(name = "当天施工开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
//    private LocalDateTime constructStartTime;
//
//    @ApiModelProperty("当天施工结束时间")
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
//    @Excel(name = "当天施工结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
//    private LocalDateTime constructEndTime;


    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @ApiModelProperty("创建人")
    @TableField(fill = FieldFill.INSERT)
    private String createBy;

    @ApiModelProperty("修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @ApiModelProperty("更新人")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updateBy;
}
